#include<iostream>
#include<iomanip>
using namespace std;
class Date {
protected:
	int year;
	int month;
	int day;
public:
	Date(){}
	Date(int y, int m, int d):year(y),month(m),day(d){}
};
class Time {
protected:
	int hour;
	int minute;
	int second;
public:
	Time(){}
	Time(int h, int m, int s) :hour(h), minute(m), second(s) {	}
};
class Work :public Date, public Time {
protected:
	int id;
public:
	friend bool before(const Work& w1, const Work& w2);
	Work(){}
	Work(int i,int y,int m1,int d,int h,int m2,int s):Date(y,m1,d),Time(h,m2,s),id(i){}
	void set(int i, int y, int m1, int d, int h, int m2, int s) {
		id = i;
		year = y;
		month = m1;
		day = d;
		hour = h;
		minute = m2;
		second = s;
	}
	void print() {
		cout << "The urgent Work is No." << id << ": " << year << '/';
		cout << setfill('0') << setw(2) << month << '/';
		cout << setfill('0') << setw(2) << day << ' ';
		cout << setfill('0') << setw(2) << hour << ':';
		cout << setfill('0') << setw(2) << minute << ':';
		cout << setfill('0') << setw(2) << second;
	}
};
bool before(const Work& w1, const Work& w2) {
	if (w1.year < w2.year) {
		return true;
	}
	else if (w1.year == w2.year) {
		if (w1.month < w2.month) {
			return true;
		}
		else if (w1.month == w2.month) {
			if (w1.day < w2.day) {
				return true;
			}
			else if (w1.day == w2.day) {
				if (w1.hour < w2.hour) {
					return true;
				}
				else if (w1.hour == w2.hour) {
					if (w1.minute < w2.minute) {
						return true;
					}
					else if (w1.minute == w2.minute) {
						if (w1.second < w2.second) {
							return true;
						}
						else {
							return false;
						}
					}
					else {
						return false;
					}
				}
				else {
					return false;
				}
			}
			else {
				return false;
			}
		}
		else {
			return false;
		}
	}
	else {
		return false;
	}
}
int main()
{
	int id;
	int year;
	int month;
	int day;
	int hour;
	int minute;
	int second;
	cin >> id;
	if (id) {
		cin >> year >> month >> day >> hour >> minute >> second;
	}
	else {
		return 0;
	}
	Work w(id, year, month, day, hour, minute, second);
	cin >> id;
	while (id) {
		cin >> year >> month >> day >> hour >> minute >> second;
		Work w1(id, year, month, day, hour, minute, second);
		if (before(w1, w)) {
			w.set(id, year, month, day, hour, minute, second);
		}
		cin >> id;
	}
	w.print();
	return 0;
}